# coding: utf-8
# @Time    : 2023/12/14 11:38
# @Author  : gongshuangxi
# @Email   : sxgong@topdatasec.com

import sys
from libs import base
from macro import recode
from libs.common import tdslogger, redprint
from flask import jsonify, request, Response

try:
    # python2
    reload(sys)
    sys.setdefaultencoding('utf-8')
except:
    # python3
    pass


api = redprint('/xx')


@api.route("/get", methods=["GET"])
def xx_get():
    tdslogger.info("in xx_get")
    result, owner_dict = base.check_get_token(tdslogger)
    if not result:
        return jsonify(owner_dict)

    re_dict = dict()
    re_dict['recode'] = recode.COMMON_OK
    re_dict['remsg'] = "操作成功"
    re_dict['data'] = list()
    return jsonify(re_dict)




@api.route('/post', methods=['POST'])
def xx_post():
    tdslogger.info("in xx_post")
    need_key_list = ['tds_token']
    result, re_dict = base.check_common_data(need_key_list, tdslogger)
    if not result:
        tdslogger.error("call base.check_common_data faild")
        return jsonify(re_dict)

    re_dict = dict()
    re_dict['recode'] = recode.COMMON_OK
    re_dict['remsg'] = "操作成功"
    return jsonify(re_dict)
